from django.db import models

# Create your models here.

class Author(models.Model):
    SEX=(('1','男'),('2','女'))
    name=models.CharField(max_length=255,null=False)
    sex=models.CharField(max_length=1,choices=SEX)
    birthday=models.DateField()
    icon=models.CharField(max_length=255)#存储图片地址
    phone=models.CharField(max_length=11)
    brief=models.TextField()


class Blog(models.Model):
    title=models.CharField(max_length=255)
    content=models.TextField()
    publish_time=models.DateTimeField(auto_now_add=True)#第一次数据创建的时候时间
    update_time=models.DateTimeField(auto_now=True)#最后修改的日期，save方法才有效,filter update 无效
    author=models.ForeignKey(Author,on_delete=models.CASCADE)


from django.contrib.auth.models import User

class Record(models.Model):
    username=models.CharField(max_length=255)
    authorname=models.CharField(max_length=255)


    # user=models.OneToOneField(User)
    # author=models.OneToOneField(Author)





















